import Taro, { Component } from '@tarojs/taro'
import { View, Image } from '@tarojs/components'
import { post } from '../../../service/api'
import './hot.scss'

class Temp extends Component {
  constructor() {
    super(...arguments)
    this.state = {
      hotList: []
    }
  }
  async getHotList() {
    const { data } = await post('home/findpopular');
    if (data.code == 0) {
      this.setState({
        hotList: data.rows
      })
    }
  }
  componentDidMount() {
    this.getHotList()
  }
  render() {
    const { hotList } = this.state;
    return (
      <View className='h-hot'>
        <View className="h-title">热门推荐</View>
        <View className="hot-content">
          <View className="hot-up">
            <View className="hot-up-l">
              <Image className="img" src={hotList[0].logo} />
            </View>
            <View className="hot-up-r">
              <Image className="img" src={hotList[1].logo} />
              <Image className="img" src={hotList[2].logo} />
            </View>
          </View>
          <View className="hot-sub">
            <Image className="img" src={hotList[3].logo} />
          </View>
        </View>
      </View>
    )
  }
}

export default Temp
